package com.sbc.order.controller;

import com.sbc.convention.result.Result;
import com.sbc.log.annotation.ILog;
import com.sbc.order.pojo.vo.TicketOrderDetailRespVo;
import com.sbc.order.service.ITOrderItemService;
import com.sbc.order.service.ITOrderService;
import com.sbc.web.Results;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 订单表 前端控制器
 * </p>
 *
 * @author songbaicheng
 * @since 2024-05-11
 */
@ILog
@RestController
@RequestMapping("/api/order")
@RequiredArgsConstructor
public class TicketOrderController {

    private final ITOrderService orderService;
    private final ITOrderItemService orderItemService;

    /**
     * 根据订单号查询车票订单
     */
    @GetMapping({"/query/", "/query/{orderSn}"})
    public Result<TicketOrderDetailRespVo> queryTicketOrderByOrderSn(@PathVariable(value = "orderSn", required = false) String orderSn) {
        return Results.success(orderService.queryTicketOrderByOrderSn(orderSn));
    }
}
